package com.chixing.job;

import com.chixing.service.IRoomInventoryService;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class SampleJob {
    @Autowired
    private IRoomInventoryService roomInventoryService;

    @XxlJob("demoJobHandler")
    public void demoJobHandler() throws Exception {
        // 业务逻辑写这里
        System.out.println(">>>>>>>>>>>>>执行定时任务");
        roomInventoryService.generateInventory();
        System.out.println(">>>>>>>>>>>>>定时任务执行完成!");
    }
    @XxlJob("inventoryArchive")
    public void monthlyInventoryArchive() {
        roomInventoryService.archiveInventoryMonthly();
    }

}
